﻿<%@ Page Title="Quản lí cơ quan, ban ngành" Language="C#" MasterPageFile="~/Views/MasterPageViews.master"
    AutoEventWireup="true" CodeFile="Organizations.aspx.cs" Inherits="Views_Organizations" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="ContentChange" ContentPlaceHolderID="ContentPlaceHolderChange" runat="Server">
    <h3 class="header-title">
        <ext:Label StyleHtmlCls="lable-message" StyleHtmlContent="true" ID="lblHeader" runat="server" Text="Quản lí cơ quan, tổ chức"
            Icon="ApplicationFormMagnify" />
    </h3>
    <div class="content-sub">
        <ext:Toolbar ID="ToolbarFunctions" runat="server">
            <Items>
                <ext:Button ID="btnToobarAdd" runat="server" Text="Thêm mới" Icon="Add" OnDirectClick="btnToobarAdd_DirectClick" />
                <ext:Button ID="btnToobarUpdate" runat="server" Text="Chỉnh sửa" Icon="Pencil" OnDirectClick="btnToobarUpdate_DirectClick" />
                <ext:Button ID="btnToobarDelete" runat="server" Text="Xóa" Icon="Delete" OnDirectClick="btnToobarDelete_DirectClick" />
                <ext:Button ID="btnToobarHelp" runat="server" Text="Hỗ trợ" Icon="Help" />
            </Items>
        </ext:Toolbar>
        <!--Store for Organization gridpanel-->
        <ext:Store
            ID="StoreOrganization"
            runat="server"
            OnReadData="StoreOrganization_ReadData"
            PageSize="10">
            <Model>
                <ext:Model ID="ModelOrganization" runat="server" IDProperty="OrgID">
                    <Fields>
                        <ext:ModelField Name="OrgID" />
                        <ext:ModelField Name="CodeOfOgran" />
                        <ext:ModelField Name="NameOfOrgan" />
                        <ext:ModelField Name="NameOfComm" />
                        <ext:ModelField Name="NameOfDist" />
                        <ext:ModelField Name="NameOfProvince" />
                        <ext:ModelField Name="Descriptons" />
                        <ext:ModelField Name="OrgStatus" Type="Boolean" />
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
        <!----------------->
        <!--Gridpanel Organization-->
        <ext:GridPanel
            ID="GridPanelOrganization"
            runat="server"
            StoreID="StoreOrganization"
            Title="Danh sách cơ quan tổ chức"
            Height="300"
            Split="true"
            AutoScroll="True">
            <ColumnModel ID="ColumnModelOrganization" runat="server">
                <Columns>
                    <ext:Column ID="Col_ID" runat="server" Text="ID" DataIndex="OrgID" Hidden="false" />
                    <ext:Column ID="Col_Code" runat="server" Text="Mã cơ quan" DataIndex="CodeOfOgran" />
                    <ext:Column ID="Col_Name" runat="server" Text="Tên cơ quan" DataIndex="NameOfOrgan" Flex="1" />

                    <ext:Column ID="Col_Des" runat="server" Text="Mô tả" DataIndex="Descriptons" />
                    <ext:CheckColumn ID="Col_stt" runat="server" Text="Trạng thái" DataIndex="OrgStatus" />
                    <ext:Column ID="Col_NameOfComm" runat="server" Text="Xã phường" DataIndex="NameOfComm" />
                    <ext:Column ID="Col_NameOfDist" runat="server" Text="Quận huyện" DataIndex="NameOfDist" />
                    <ext:Column ID="Col_NameOfProvince" runat="server" Text="Tỉnh thành" DataIndex="NameOfProvince" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModelOrganization" runat="server" Mode="Single">
                    <DirectEvents>
                        <Select OnEvent="RowSelect" Buffer="100" />
                    </DirectEvents>
                </ext:RowSelectionModel>
            </SelectionModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbarOrganization" runat="server" StoreID="StoreOrganization" BeforePageText="Trang"
                    EmptyMsg="Chưa có dữ liệu" AfterPageText="trên  {0}"
                    DisplayMsg="Hiển thị bản ghi {0} - {1} trên tổng số {2}" RefreshText="Làm mới" LastText="Trang cuối"
                    NextText="Trang kế" PrevText="Trang trước" FirstText="Trang đầu" />
            </BottomBar>
        </ext:GridPanel>
        <!--------------------->

        <!-- Cửa sổ popup thêm mới cơ quan -->
        <ext:Window
            ID="WindownAdd"
            runat="server"
            Title="Thêm mới cơ quan"
            Icon="ApplicationAdd"
            Height="340"
            Width="350"
            BodyStyle="background-color: #fff;"
            Modal="true"
            ShadowMode="Drop"
            Hidden="true">
            <Content>
                <ext:Toolbar ID="ToolbarAdd" runat="server">
                    <Items>
                        <ext:Button ID="btnAdd" runat="server" Text="Lưu lại" Icon="Disk">
                            <Menu>
                                <ext:Menu ID="MenuAddButton" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="menuItemAdd" runat="server" Text="Lưu lại" Icon="DiskBlack" OnDirectClick="menuItemAdd_DirectClick" />
                                        <ext:MenuItem ID="menuItemAddAndClose" runat="server" Text="Lưu lại và đóng" Icon="DiskBlack" OnDirectClick="menuItemAddAndClose_DirectClick" />
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:Button ID="btnAddCancel" runat="server" Text="Hủy bỏ" Icon="Delete" OnDirectClick="btnAddCancel_DirectClick" />
                    </Items>
                </ext:Toolbar>
                <div class="content-popup-style">
                    <div class="view-msg-popup">
                        <ext:Label ID="lblFormAddMsg" runat="server" StyleHtmlContent="True" Cls="lable-message-error" />
                    </div>
                    <div>
                        <!-- Selectbox provinces --->
                        <ext:SelectBox
                            ID="cbxProvinces"
                            runat="server"
                            DisplayField="NameOfProvince"
                            ValueField="ProvID"
                            EmptyText="Lựa chọn"
                            FieldLabel="Tỉnh thành"
                            Width="310"
                            MarginSpec="5 0 5 0">
                            <Store>
                                <ext:Store ID="storeProvince" runat="server">
                                    <Model>
                                        <ext:Model ID="modelProvince" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="ProvID" />
                                                <ext:ModelField Name="NameOfProvince" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <Listeners>
                                <Select Handler="App.direct.cbxProvinces_SelectedChange();" />
                            </Listeners>
                        </ext:SelectBox>
                        <!--------------------->

                        <!-- Selectbox districts --->
                        <ext:SelectBox
                            ID="cbxDistrict"
                            runat="server"
                            DisplayField="NameOfDist"
                            ValueField="DistID"
                            EmptyText="Lựa chọn"
                            FieldLabel="Quận huyện"
                            Width="310"
                            MarginSpec="5 0 5 0">
                            <Store>
                                <ext:Store ID="StoreDistrict" runat="server">
                                    <Model>
                                        <ext:Model ID="ModelDistrict" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="DistID" />
                                                <ext:ModelField Name="NameOfDist" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <Listeners>
                                <Select Handler="App.direct.cbxDistrict_SelectedChange();" />
                            </Listeners>
                        </ext:SelectBox>
                        <!--------------------->

                        <!-- Selectbox Communes --->
                        <ext:SelectBox
                            ID="cbxCommune"
                            runat="server"
                            DisplayField="NameOfComm"
                            ValueField="ComID"
                            EmptyText="Lựa chọn"
                            FieldLabel="Xã phường"
                            Width="310"
                            MarginSpec="5 0 5 0">
                            <Store>
                                <ext:Store ID="StoreCommune" runat="server">
                                    <Model>
                                        <ext:Model ID="ModelCommune" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="ComID" />
                                                <ext:ModelField Name="NameOfComm" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                        </ext:SelectBox>
                        <!--------------------->
                        <ext:TextField ID="txtFormAddCodeOrg" runat="server" FieldLabel="Mã cơ quan" Width="310" MarginSpec="5 0 5 0" />
                        <ext:TextField ID="txtFormAddNameOrg" runat="server" FieldLabel="Tên cơ quan" Width="310" MarginSpec="5 0 5 0" />
                        <ext:TextArea ID="txtFormAddDes" runat="server" FieldLabel="Mô tả" Width="310" MarginSpec="5 0 5 0" />
                        <ext:Checkbox ID="chkFormAddStatus" runat="server" FieldLabel="Trạng thái" BoxLabel="Cho phép hoạt động" />
                    </div>
                </div>
            </Content>
        </ext:Window>
        <!-----end------->

        <!-- Cửa sổ popup cập nhật thông tin cơ quan -->
        <ext:Window
            ID="WindowUpdate"
            runat="server"
            Title="Cập nhật thông tin cơ quan"
            Icon="Pencil"
            Height="330"
            Width="350"
            BodyStyle="background-color: #fff;"
            Modal="true"
            ShadowMode="Drop"
            Hidden="true">
            <Content>
                <ext:Toolbar ID="ToolbarUpdate" runat="server">
                    <Items>
                        <ext:Button ID="btnUpdateSave" runat="server" Text="Cập nhật" Icon="Disk" OnDirectClick="btnUpdateSave_DirectClick" />
                        <ext:Button ID="btnUpdateCancel" runat="server" Text="Hủy bỏ" Icon="Delete" OnDirectClick="btnUpdateCancel_DirectClick" />
                    </Items>
                </ext:Toolbar>
                <div class="content-popup-style">
                    <div class="view-msg-popup">
                        <ext:Label ID="lblUpdateMsg" runat="server" StyleHtmlContent="True" Cls="lable-message-error" />
                    </div>
                    <div>
                        <ext:TextField ID="txtUpdateProvince" runat="server" FieldLabel="Tỉnh thành" Width="310" MarginSpec="5 0 5 0" Disabled="true" />
                        <ext:TextField ID="txtUpdateDistrict" runat="server" FieldLabel="Quận huyện" Width="310" MarginSpec="5 0 5 0" Disabled="true" />
                        <ext:TextField ID="txtUpdateCommune" runat="server" FieldLabel="Xã phường" Width="310" MarginSpec="5 0 5 0" Disabled="true" />
                        <ext:TextField ID="txtUpdateCodeOfOrg" runat="server" FieldLabel="Mã cơ quan" Width="310" MarginSpec="5 0 5 0" />
                        <ext:TextField ID="txtUpdateNameOfOrg" runat="server" FieldLabel="Tên cơ quan" Width="310" MarginSpec="5 0 5 0" />
                        <ext:TextArea ID="txtUpdateDes" runat="server" FieldLabel="Mô tả" Width="310" MarginSpec="5 0 5 0" />
                        <ext:Checkbox ID="chkUpdateStatus" runat="server" FieldLabel="Trạng thái" BoxLabel="Cho phép hoạt động" />
                    </div>
                </div>
            </Content>
        </ext:Window>
        <!-----end------->

    </div>
    <div class="view-info-record">
        <h3 class="header-title">
            <ext:Label StyleHtmlCls="lable-message" StyleHtmlContent="true" ID="lblDistHead" runat="server" Text="Hiển thị thông tin của cơ quan, tổ chức"
                Icon="Information" />
        </h3>
        <div class="content-info">
            <table>
                <tr>
                    <td class="with-td-view-info">Mã :</td>
                    <td>
                        <ext:Label ID="lblViewCodeOfOrg" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Cơ quan, tổ chức :</td>
                    <td>
                        <ext:Label ID="lblViewNameOfOrg" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Mô tả :</td>
                    <td>
                        <ext:Label ID="lblViewDesOfOrg" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Xã phường :</td>
                    <td>
                        <ext:Label ID="lblViewCommune" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Quận huyện :</td>
                    <td>
                        <ext:Label ID="lblViewDistrict" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Tỉnh thành :</td>
                    <td>
                        <ext:Label ID="lblViewProvince" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Trạng thái:</td>
                    <td>
                        <ext:Checkbox ID="chkViewDistStatus" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Content>
